//
//  ChartCollectionViewCell.m
//  ZhiBoYuan
//
//  Created by coder_di on 2018/5/7.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "ChartCollectionViewCell.h"

@implementation ChartCollectionViewCell
{
    SCPieChart *chartView;
}

-(void)setModel:(TongJiModel *)model{
    
    if (chartView) {
        [chartView removeFromSuperview];
        chartView = nil;
    }
    NSArray *items = @[[SCPieChartDataItem dataItemWithValue:100 - model.right_percent color:[UIColor orangeColor] description:@""],
                       [SCPieChartDataItem dataItemWithValue:model.right_percent color:ZhuTiColor description:@""],
                       ];
    chartView = [[SCPieChart alloc] initWithFrame:CGRectMake(0, 0, 70 * KscreenWidth, 70 * KscreenHeight) items:items];
    chartView.descriptionTextColor = [UIColor whiteColor];
    chartView.descriptionTextFont  = [UIFont fontWithName:@"Avenir-Medium" size:12.0];
    [chartView strokeChart];
    [self.contentView addSubview:chartView];
}



-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {

        
        self.nameLable = [[UILabel alloc]initWithFrame:CGRectMake(10 * KscreenWidth, 70 * KscreenHeight, 50 * KscreenWidth, 30 * KscreenHeight)];
        self.nameLable.textAlignment = NSTextAlignmentCenter;
        self.nameLable.font = [UIFont systemFontOfSize:15 * KscreenWidth];
        //        self.nameLable.text = @"孙悟空";
        [self.contentView addSubview:self.nameLable];
        
    }
    return self;
}

@end
